<%-- 
    Document   : pages-body
    Created on : 17-Dec-2012, 13:11:22
    Author     : Roald
--%>
<%@page import="nl.hva.web.mvcwebapp.doa.PageDAO"%>
<%@page import="nl.hva.web.mvcwebapp.models.Page"%>
<%@page import="nl.hva.web.mvcwebapp.models.PageWidget"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@include file="/WEB-INF/templates/configuration.jsp" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<h2>${pageTitle}</h2>
<hr/>

<c:choose>
    <c:when test="${allPages.size() != 0}">
        <!-- Wanneer er gebruikers opgeslagen zijn, worden ze hier getoond -->
        <table class="zebra">
            <tr>
                <th>
                    <strong>PageId</strong>
                </th>
                <th>
                    <strong>PageName</strong>
                </th>
                <th>
                    <strong>PagePath</strong>
                </th>
                <th>
                    <strong>PageLayout</strong>
                </th>
                <th>
                    <strong>PageColor</strong>
                </th>
                <th>
                    <strong>PageBackground</strong>
                </th>
            </tr>
            <c:forEach var="tempPage" items="${allPages}">
                <tr>
                    <td>
                        ${tempPage.pageId}
                    </td>
                    <td>
                        ${tempPage.pageName}
                    </td>
                    <td>
                        ${tempPage.pagePath}
                    </td>
                    <td>
                        ${tempPage.pageLayout}
                    </td>
                    <td>
                        ${tempPage.pageColor}
                    </td>
                    </td>
                    <td>
                        ${tempPage.pageBackground}
                    </td>
                    <!--                    <td>
                                            <a href="${url}news/edit?newsid=${tempPage.pageId}">edit</a> |
                                            <a href="${url}news/view?newsid=${tempPage.pageId}">view</a> |
                                            <a href="${url}news/delete?newsid=${tempPage.pageId}">delete</a>
                                                                            <a href="javascript:if(confirm('Weet u zeker dat u dit nieuws wil verwijderen?'))
                                                                               window.location='news/delete?newsid=${tempPage.pageId}';">delete</a>
                                        </td>-->
                </tr>
            </c:forEach>
        </table>
    </c:when>
    <c:otherwise>
        There are no pages found.
    </c:otherwise>
</c:choose>

<h2>Widgets</h2>
<hr/>
<c:choose>
    <c:when test="${allWidgets.size() != 0}">
        <!-- Wanneer er gebruikers opgeslagen zijn, worden ze hier getoond -->
        <table class="zebra">
            <tr>
                <th>
                    <strong>WidgetId</strong>
                </th>
                <th>
                    <strong>WidgetName</strong>
                </th>
                <th>
                    <strong>WidgetPath</strong>
                </th>
            </tr>
            <c:forEach var="tempWidget" items="${allWidgets}">
                <tr>
                    <td>
                        ${tempWidget.widgetId}
                    </td>
                    <td>
                        ${tempWidget.name}
                    </td>
                    <td>
                        ${tempWidget.widgetPath}
                    </td>
                    <!--                    <td>
                                            <a href="${url}news/edit?newsid=${tempWidget.widgetId}">edit</a> |
                                            <a href="${url}news/view?newsid=${tempWidget.widgetId}">view</a> |
                                            <a href="${url}news/delete?newsid=${tempWidget.widgetId}">delete</a>
                                                                            <a href="javascript:if(confirm('Weet u zeker dat u dit nieuws wil verwijderen?'))
                                                                               window.location='news/delete?newsid=${tempWidget.widgetId}';">delete</a>
                                        </td>-->
                </tr>
            </c:forEach>
        </table>
    </c:when>
    <c:otherwise>
        <!-- Als er geen gebruikers zijn, wordt deze melding getoond -->
        There are no widgets found.
    </c:otherwise>
</c:choose>
        
<h2>Page-Widgets</h2>
<hr/>
<c:choose>
    <c:when test="${allPageWidgets.size() != 0}">
        <!-- Wanneer er gebruikers opgeslagen zijn, worden ze hier getoond -->
        <table class="zebra">
            <tr>
                <th>
                    <strong>WidgetId</strong>
                </th>
                <th>
                    <strong>WidgetName</strong>
                </th>
                <th>
                    <strong>WidgetPath</strong>
                </th>
            </tr>
            <c:forEach var="tempPageWidget" items="${allPageWidgets}">
                <tr>
                    <td>
                        ${tempPageWidget.widgetLocation}
                    </td>
                    <td>
                        ${tempPageWidget.page.pageId}
                    </td>
                    <td>
                        ${tempPageWidget.widget.widgetId}
                    </td>
                </tr>
            </c:forEach>
        </table>
    </c:when>
    <c:otherwise>
        <!-- Als er geen gebruikers zijn, wordt deze melding getoond -->
        There are no page-widgets found.
    </c:otherwise>
</c:choose>


<!--<p>
    News course overview       
    <a href="${url}news/view/course?courseid=1">view</a>
    <a class="button" href="${url}news/new">Add a new News item</a>
</p>-->

